version: '2.1'
services:
- name: rbd-gateway
  health:
    name: rbd-gateway
    model: http
    address: 127.0.0.1:10254/healthz
    max_errors_num: 3
    time_interval: 5
  after:
    - docker
  type: simple
  pre_start: docker rm -f rbd-gateway
  start: >-
    docker run --name rbd-gateway
    --network host
    --privileged
    -v {{ rbd_dir }}/etc/kubernetes/kubecfg:/opt/rainbond/etc/kubernetes/kubecfg
    -v {{ rbd_dir }}/etc/rbd-gateway/ssl:/run/nginx/rainbond/ssl
    -v /grdata/services/offline:/grdata/services/offline
    -e DEFAULT_PORT=80
    -i goodrain.me/{{ gateway }}
    --etcd-endpoints=${ETCD_ENDPOINTS}
    --log-level=info
    --error-log=/dev/stderr error {% if deploy_type != "thirdparty" %}--enable-kubeapi=true{% endif %}

  stop: docker stop rbd-gateway
  restart_policy: always
  restart_sec: 10